// pages/other/other.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    itemList: [],
    pageState: true
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var id = decodeURIComponent(options.id)
    if (id === "New Exotic Items") {
      var that = this
      wx.request({
        url: 'http://daxian.viphk.ngrok.org/api/getNewExoticItems',
        data: {},
        header: {
          'content-type': 'application/json' // 默认值
        },
        success(res) {
          console.log(res.data)
          that.setData({
            itemList: res.data,
            pageState: false
          })
        }
      })

    } else if (id == "New Quests") {
      this.getData(53, 14)
    } else if (id == "New Shaders") {
      this.getData(41, 14)
    } else if (id == "New Sparrows") {
      this.getData(43, 14)
    } else if (id == "New Ships") {
      this.getData(42, 14)
    } else {
      this.getData(39, 14)

    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  getData(c, s) {
    var that = this
    wx.request({
      url: 'http://daxian.viphk.ngrok.org/api/getNewItems', //仅为示例，并非真实的接口地址
      data: {
        c: c,
        s: s
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        console.log(res)
        that.setData({
          itemList: res.data,
          pageState:false
        })
      }
    })
  }
})